/**
 * Created with IntelliJ IDEA.
 * Author: Dax
 * Description:
 * Date: 2018/7/8
 * Time: 18:55
 */

const SOCKET_TOOLS = {
    url: '',
    options: {
        onopen() {
            console.log('webSocket is open');
        },
        onmessage(event) {
            console.log(event)
        },
        onerror() {

        },
        onclose() {

        }
    },
    init() {
        let socketInstance = new SockJS(this.url);
        socketInstance.onopen = this.options.onopen;
        socketInstance.onmessage = this.options.onmessage;
        socketInstance.onerror = this.options.onerror;
        socketInstance.onclose = this.options.onclose;
        return socketInstance;
    }
};




